require 'digest/sha1'
class User < ActiveRecord::Base
  belongs_to :hospice
  
  def self.authenticate(email_address, password)
    find(:first, :conditions => { :email_address => email_address, :password => Digest::SHA512.hexdigest(password) })
  end
  
  def password=(str)
    write_attribute("password", Digest::SHA512.hexdigest(str))
  end
  
  def password
    ""
  end
end
